package com.sunny.ynhz.utils;


import android.util.Log;

import com.sunny.ynhz.bean.ProblemTpyeBean;
import com.sunny.ynhz.bean.ProblemTypeDataBean;

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/**
 * Created by luao on 2017/6/12.
 */

public class TypeAndStatusUtil {
    //    private static String[] problemTpye = {"垃圾堆积", "违法建筑", "漂浮物", "化学药品", "违法屯垦", "违法垂钓"};
    private static String[] problemStatus = {"进行中", "已上报"};
    private static String[] patrolType = {"计划", "交办", "突发事件"};

    private static LinkedHashMap<String, String> problemTpyeMap = new LinkedHashMap<>();
    ;

    public TypeAndStatusUtil() {
    }


    /**
     * 获得问题类型
     *
     * @param problemType
     * @return
     */
    public static String getProblemTpye(String problemType) {
        return problemTpyeMap.get(problemType);
    }

    /**
     * @return
     */
    public static LinkedHashMap<String, String> getProblemTpye() {
        return problemTpyeMap;
    }

    public static void setProblemTpye(ProblemTypeDataBean problemTpye) {
        List<ProblemTypeDataBean.DateBean> date = problemTpye.getDate();
        for (int i = 0; i < date.size(); i++) {
            ProblemTypeDataBean.DateBean dateBean = date.get(i);
            String label = dateBean.getLabel();
            String value = dateBean.getValue();
            problemTpyeMap.put(value, label);
        }
    }

    public static String getProblemValueByTable(String table) {
        Set<String> strings = problemTpyeMap.keySet();
        Iterator<String> iterator = strings.iterator();
        while (iterator.hasNext()) {
            String next = iterator.next();
            String value = problemTpyeMap.get(next);
            if (value.equals(table)) {
                return next;
            }
        }
        return "";
    }

    /**
     * @return
     */
    public static String getProblemValue(String key) {
        return problemTpyeMap.get(key);
    }

}
